package org.jeecg.modules.demo.hd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.demo.hd.entity.AppConfig;
import org.jeecg.modules.demo.hd.mapper.AppConfigMapper;
import org.jeecg.modules.demo.hd.service.IAppConfigService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: app_config
 * @Author: jeecg-boot
 * @Date:   2025-05-01
 * @Version: V1.0
 */
@Service
public class AppConfigServiceImpl extends ServiceImpl<AppConfigMapper, AppConfig> implements IAppConfigService {

    @Override
    public AppConfig getConfig() {
        LambdaQueryWrapper<AppConfig> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(AppConfig::getStatus, "1");
        List<AppConfig> list = this.baseMapper.selectList(queryWrapper);
        if (list != null && list.size() > 0) {
            return list.get(0);
        }
        return new AppConfig();
    }
}
